<#-- @ftlvariable name="entity" type="com.xci.edu.background.entity.ExamRecordDetails" -->
<#include "/sys/_layout.ftl">
<#assign allowInsert=sysWeb.auth("background.examRecordDetails.insert")/>
<#assign allowUpdate=sysWeb.auth("background.examRecordDetails.update")/>
<#assign allowDelete=sysWeb.auth("background.examRecordDetails.delete")/>
<#assign allowExport=sysWeb.auth("background.examRecordDetails.export")/>
<!doctype html>
<html>
<head>
    <@pageHeader/>
</head>
<body>
<@pageLoading/>
<div id="gridtoolbar">
    <form id="gridform" class="jxlayout-form form-inline jxform">
        <div class="form-group">
            <input name="key" class="form-control w-250px" placeholder="请输入查询关键字" autocomplete="off">
        </div>
        <div class="form-group">
            <select name="status" class="jxselect form-control" data-select-submit="true" data-allow-clear="false" data-width="110">
                ${web.statusSelectOptions()}
            </select>
        </div>
        <button class="btn btn-primary ml-5" type="submit">
            <i class="fa fa-search"></i> 查询
        </button>
        <div class="btn-group">
            <@echo test=allowInsert>
            <a class="btn btn-default" onclick="curd.createData()">
                <i class="icon-plus"></i> 新建
            </a>
        </@echo>
        <@echo test=allowUpdate>
            <a class="btn btn-default" onclick="curd.editData()">
                <i class="icon-pencil"></i> 编辑
            </a>
        </@echo>
        <@echo test=allowDelete>
            <a class="btn btn-default" onclick="curd.deleteData()">
                <i class="icon-trash"></i> 删除
            </a>
        </@echo>
        <@echo test=allowExport>
            <a class="btn btn-default" onclick="curd.exportData()">
                <i class="icon-share-alt"></i> 导出
            </a>
        </@echo>
        </div>
    </form>
</div>
<table id="grid" data-options="form:'#gridform',toolbar:'#gridtoolbar'">
    <thead>
    <tr>
        <th data-options="field:'ck',checkbox:true"></th>
        <th data-options="title:'考试记录主键',field:'recordId',width:200,align:'left',sortable: false"></th>
        <th data-options="title:'试题主键',field:'questionId',width:200,align:'left',sortable: false"></th>
        <th data-options="title:'用户答案',field:'answer',width:200,align:'left',sortable: false"></th>
        <th data-options="title:'状态[1-正确, 0-错误]',field:'status',width:200,align:'left',sortable: false,formatter:jx.gf.status"></th>
        <th data-options="title:'排序号',field:'path',width:200,align:'left',sortable: false"></th>
    </tr>
    </thead>
</table>
<@pageFooter/>
<script>
jx.ready(function () {
    window.curd = new jx.GridCurd('#grid', {
        title: '考试试题明细',
        dialogWidth: '600px',
        dialogHeight: '400px',
        api: {
            grid: '/background/examRecordDetails/grid',
            create: '/background/examRecordDetails/create',
            edit: '/background/examRecordDetails/edit',
            delete: '/background/examRecordDetails/delete',
            details: '/background/examRecordDetails/details',
            status: '/background/examRecordDetails/status',
            export: '/background/examRecordDetails/export'
        },
        onInit: function (instance) {
            //状态事件
            instance.gridPanel.on('click', '.gridstatus', function () {
                instance.setStatusDataById($(this).data('id'), $(this).data('val') == '1' ? 0 : 1);
            });
        }
    });
});
</script>
</body>
</html>